<?php
include '../../conn.php';
$data = json_decode($HTTP_RAW_POST_DATA);
$sql = "select * from users_info
        where id = $data->id
        limit 1";
$isUser = $pdo->getOne($sql);
if($isUser) {
    $sql = "select b.id,c.nickname,b.title,b.images,b.type,b.update_time from users_collect as a
        left join users_content as b
        on a.notice_id = b.id
        left join users_info as c
        on a.user_id = c.id
        where a.user_id = $data->id and a.status = 1";
    $req = $pdo->getAll($sql);
    $arr = array();
    foreach($req as $res):
        $imgs = preg_split("/[,]+/",$res['images']);
        $imgarr = array();
        foreach($imgs as $img):
            array_push(
                $imgarr,[
                    "content" => "$url$img"
                ]
            );
        endforeach;
        array_push(
            $arr,[
                "id" => $res['id'],
                "nickname" => $res['nickname'],
                "title" => "$res[title]",
                "images" => $imgarr,
                "type" => "$res[type]",
                "time" => "$res[update_time]"
            ]
        );
    endforeach;
}else {
    $arr = [
        "code" => 400,
        "desc" => '用户信息错误,请重试'
    ];
}
echo json_encode($arr);
exit;